<?php
/**
 * Created by PhpStorm.
 * User: junyv
 * Date: 2016/9/18
 * Time: 11:52
 */

namespace app\manage\controller;
class HousePrice extends Base
{
    private $house_id;
    //前置操作定义
    protected $beforeActionList = [
        'beforeIndex' =>  ['only'=>'index'],
    ];
    public function _initialize(){
        $this->house_id = input('param.house_id/d',0);
        $this->param_extra = ['house_id'=>$this->house_id];
        parent::_initialize();
        $this->mod = model('house_price');
        $this->sort = 'date_time';
        $this->order = 'desc';
        $this->getHouseInfo();
        $this->assign('house_id',$this->house_id);
    }
    public function beforeIndex(){
        $big_menu = [
            'title' => '添加价格',
            'iframe' => url('add',['house_id'=>$this->house_id]),
            'id' => 'add',
            'width' => '500',
            'height' => '360'
        ];
        $this->_ajaxedit = true;
        $this->assign('big_menu', $big_menu);
    }
    //搜索
    public function _search(){
        $map['house_id'] = $this->house_id;
        return $map;
    }
    //获取楼盘名称
    private function getHouseInfo(){
        $detail = model('house')->where(['id'=>$this->house_id])->field('id,title,city,area')->find();
        $this->assign('house',$detail);
    }
}